import datetime
import os
import pandas as pd
import Core.Config as Config
import Core.WindFunctions as Wind
from SystematicFactors.CalculateSysFactor_Wind import Automatic_Calculate_Systematic_Factors
from DataProcess.Download_Stock_Misc import Automatic_Download_Stock_Misc
from DataProcess.Download_Bond_Data import Automatic_Download_Bond_Misc

# 下载依赖数据
def download_data(database, datetime1, datetime2):
    #
    Automatic_Download_Stock_Misc(database, datetime2, startEntry=0)
    Automatic_Download_Bond_Misc(database, datetime2, startEntry=0)


if __name__ == '__main__':
    #
    path_filename = os.getcwd() + "\..\Config\config_local.json"
    database = Config.create_database(database_type="MySQL", config_file=path_filename, config_field="MySQL")
    #

    Wind.w.start()
    datetime1 = datetime.datetime(2020, 1, 1)
    datetime2 = datetime.datetime(2024, 5, 26)
    #
    download_data(database, datetime1, datetime2)



